package com.corpgovernment.common.enums;

import java.util.stream.Stream;

/**
 * @author wangyujue
 */
public enum DemandStatusEnum {
    RP("RP", "询价中", "1"),
    TW("TW", "待出票", "2"),
    TA("TA", "已出票", "3"),
    CA("CA", "已取消", "4"),
    FT("FT", "出票失败", "5"),
    NW("NW", "未胜出", "6");

    public static DemandStatusEnum getByCode(String code) {
        return Stream.of(DemandStatusEnum.values()).filter(p -> p.getCode().equals(code)).findFirst().orElse(null);
    }

    public static DemandStatusEnum getByFrontCode(String frontCode) {
        return Stream.of(DemandStatusEnum.values()).filter(p -> p.getFrontCode().equals(frontCode)).findFirst().orElse(null);
    }

    DemandStatusEnum(String code, String desc, String frontCode) {
        this.code = code;
        this.desc = desc;
        this.frontCode = frontCode;
    }

    private String code;
    private String desc;
    private String frontCode;

    public String getFrontCode() {
        return frontCode;
    }

    public void setFrontCode(String frontCode) {
        this.frontCode = frontCode;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
